require 'rho/rhocontroller'
require 'helpers/browser_helper'

class UpdatesController < Rho::RhoController
  include BrowserHelper

  #GET /Updates
  def index
    @updateses = Updates.find(:all)
    render
  end

  # GET /Updates/{1}
  def show
    @updates = Updates.find(@params['id'])
    if @updates
      render :action => :show
    else
      redirect :action => :index
    end
  end

  # GET /Updates/new
  def new
    @updates = Updates.new
    render :action => :new
  end

  # GET /Updates/{1}/edit
  def edit
    @updates = Updates.find(@params['id'])
    if @updates
      render :action => :edit
    else
      redirect :action => :index
    end
  end

  # POST /Updates/create
  def create
    @updates = Updates.create(@params['updates'])
    redirect :action => :index
  end

  # POST /Updates/{1}/update
  def update
    @updates = Updates.find(@params['id'])
    @updates.update_attributes(@params['updates']) if @updates
    redirect :action => :index
  end

  # POST /Updates/{1}/delete
  def delete
    @updates = Updates.find(@params['id'])
    @updates.destroy if @updates
    redirect :action => :index
  end
end
